﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _7_1_Class
{
    enum E_SexType
    {
        None,
        Man,
        Women,
    }

    struct Score
    {
        public float English;
        public float Chinese;
    }

    static class StaticClass
    {
        public static int Index;
        public static void PrintInfo()
        {
            Console.WriteLine("_____StaticClass:" + Index);
        }
    }
    class Student
    {
        public static int Index;
        public int ID = 1;
        public string Name;
        public E_SexType SexType;
        public int Age;
        //public float Score;
        public Score Score;

        public string Addr;

        private int TestInt;

        static Student()
        {
            Console.WriteLine("static Student()");
        }

        public Student()
        {
            Console.WriteLine("public Student()");
        }
        ~Student()
        {
            Console.WriteLine("~Student()");
        }
        public override string ToString()
        {
            return "Student ID:" + ID + " Name:" + Name + " E:" + Score.English + " C:" + Score.Chinese + " TestInt: " + TestInt;
        }
    }



    class Program
    {

        static void Main(string[] args)
        {
            //BaseGraph bg = new BaseGraph();

            Rectangle rect = new Rectangle(14, 3);
            Console.WriteLine(rect.GetGraphType());
            Console.WriteLine(rect.GetArea());
            Console.WriteLine(rect.GetGirth());

            Triangle trian = new Triangle(3,4,5);
            Console.WriteLine(trian.GetGraphType());
            Console.WriteLine(trian.GetArea());
            Console.WriteLine(trian.GetGirth());

            Square squa = new Square(10);
            Console.WriteLine(squa.GetGraphType());
            Console.WriteLine(squa.GetArea());
            Console.WriteLine(squa.GetGirth());

            Console.ReadKey();
            //----------------Static Class -------------------
            //StaticClass sc = new StaticClass();
            StaticClass.PrintInfo();
            //Console c = new Console();
            Console.ReadKey();
           
            if (true)
            {
                
                
                Student student = new Student();
                Console.WriteLine("------------");
                Student.Index = 0;
                //student

                student.ID = 1;
                student.Name = "Xiao Ming";
                student.SexType = E_SexType.Man;
                student.Age = 18;
                //student.Score = 100;
                Score score = new Score();
                score.Chinese = 99;
                score.English = 59;
                //student.Score.Chinese = 100;
                //student.Score.English = 50;
                student.Score = score;
                student.Addr = "地球";
                Console.WriteLine(student);

                Student s1 = student;

                Console.WriteLine(s1);

                s1.ID = 2;
                s1.Addr = "uasitgjhsaoijgohsohkmd;jhmdsk;lhjnmds;lhknmd;slhjdso;j";
                Console.WriteLine(student);
                Console.WriteLine(s1);

                Console.ReadKey();

                Console.WriteLine("--------------------------------");

                Student[] studentArray = new Student[2];
                studentArray[0] = s1;
                studentArray[1] = student;

                for (int i = 0; i < studentArray.Length; i++)
                {
                    Console.WriteLine(studentArray[i]);
                }

                Console.ReadKey();
            }
            
        }
    }
}
